package com.czk.demo.service;

import com.czk.spring.BeanPostProcessor;
import com.czk.spring.Component;

/**
 * 后置处理器的实现
 * @Author:ChenZhangKun
 * @Date: 2021/3/31 16:59
 */
@Component
public class BeanPostProcessorImpl2 implements BeanPostProcessor {
    @Override
    public Object postProcessBeforeInitialization(Object bean, String beanName) {
        System.out.println("初始化之前2222");
        return bean;
    }

    @Override
    public Object postProcessAfterInitialization(Object bean, String beanName) {
        System.out.println("初始化之后22222");
        // 可以返回其他对象，替换对象
        // springAop的实现，在初始化后返回代理对象
        return bean;
    }
}
